﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Kinect;

namespace ISMOT.HCI.KGL
{
    public static class GeneralExtensions
    {
        public static double Distance(this SkeletonPoint from, NullablePoint to)
        {
            var x = to.X == null ? 0 : from.X - to.X.Value;
            var y = to.Y == null ? 0 : from.Y - to.Y.Value;
            var z = to.Z == null ? 0 : from.Z - to.Z.Value;

            return (Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2) + Math.Pow(z, 2)));
        }

        public static SkeletonPoint ToMillimeters(this SkeletonPoint point)
        {
            return (new SkeletonPoint()
            {
                X = point.X * 1000,
                Y = point.Y * 1000,
                Z = point.Z * 1000,
            });
        }
    }
}
